package base

import (
	"cgs-server/server/model"
	"cgs-server/server/system"
	"go.mongodb.org/mongo-driver/bson/primitive"
)

// 转换结构体属性

func ConvertSysUser(sysUser *system.User, user *model.User) {
	id, err := primitive.ObjectIDFromHex(sysUser.ID)
	if err != nil {
		return
	}
	user.UserId = id
	user.Username = sysUser.Username
	user.Password = sysUser.Password
	user.Name = sysUser.Name
	//roleId, _ := primitive.ObjectIDFromHex( sysUser.RoleID)
	user.RoleID = sysUser.RoleID
	user.RoleName = sysUser.RoleName
	user.DeptID = sysUser.DeptID
	user.DeptName = sysUser.DeptName
	user.Gender = sysUser.Gender
	user.Phone = sysUser.Phone
	user.Email = sysUser.Email
	user.QQ = sysUser.QQ
	user.CreateTime = sysUser.CreateTime
	user.UpdateTime = sysUser.UpdateTime
	user.Salt = sysUser.Salt
	user.Status = &sysUser.Status
	user.OperatingAuthorities = sysUser.OperatingAuthorities
	user.TenantId = sysUser.TenantId
	user.AppAuths = sysUser.AppAuths
	user.VisualAppMap = sysUser.VisualAppMap
}
